package com.apes.hr.paySupport.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.rbac.model.Post;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @Title: SupportApplicationRole
 * @Description:付费支援申请单（支援角色列表）
 * @author: ZhengZeXian
 * @create: 2021/4/15 10:10
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = SupportApplicationRole.CONST_TABLE_NAME)
public class SupportApplicationRole extends Model {

    public static final String CONST_TABLE_NAME = "hr_support_application_role";

    @Id
    @Column(name = "id")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "付费支援申请单角色列表", padding = 15)
    @Comment("编码")
    private Integer id;

    @Column(name = "post_id")
    @Comment("岗位编码")
    private String postId;

    @Column(name = "post_name")
    @Comment("岗位名称")
    private String postName;

    @ManyToOne(fetch=FetchType.LAZY,cascade=CascadeType.ALL)
    @JoinColumn(name = "supportApplication_item_id",  nullable = false)
    private SupportApplicationItem supportApplicationItem;
}
